<?php

namespace app\api\controller;

use app\common\controller\Api;

/**
 * 园区
 *
 * @package app\api\controller
 */
class Garden extends Api
{
    protected $noNeedLogin = [''];
    protected $noNeedRight = ['*'];

    public function _initialize()
    {
        parent::_initialize();
    }

    /**
     * @ApiTitle    (园区列表)
     * @ApiAuthor   (Zhenzh)
     * @ApiDate     (2020/2/7)
     * @ApiSummary  (描述)
     * @ApiBody     (Body)
     * @ApiMethod   (POST)
     * @ApiRoute    (/api/garden/cxSelect)
     * @ApiHeaders  (name="token", type="string", required=true, description="请求的Token")
     * @ApiReturnParams   (name="code", type="integer", required=true, description="状态码 1正常 0错误", sample="1")
     * @ApiReturnParams   (name="msg", type="string", required=true, sample="返回成功")
     * @ApiReturnParams   (name="data", type="object", description="扩展数据返回", sample="")
     * @ApiReturn ()
     */
    public function cxSelect()
    {
        $school_id = $this->request->post('school_id', 0);

        $list = \app\common\model\Garden::where('school_id', $school_id)
            ->field('id,number,name')
            ->select();

        $this->success('', $list);
    }

}
